package com.hdl;

import com.hdl.request.Request;
import com.hdl.response.Response;
import com.hdl.servlet.HttpServlet;
import com.hdl.utils.HttpProtocolUtils;

import java.io.IOException;

/**
 * 类名 Demo1Servlet
 * 描述 TODO
 *
 * @author hedonglin
 * @version 1.0
 * @date 2020/5/31 19:11
 */
public class Demo4Servlet extends HttpServlet {
    @Override
    public void doGet(Request request, Response response) {
        String content = "<h1>Demo4Servlet get</h1>";
        try {
            response.output((HttpProtocolUtils.getHttpHeader200(content.getBytes().length) + content));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void doPost(Request request, Response response) {
        String content = "<h1>Demo4Servlet get</h1>";
        try {
            response.output((HttpProtocolUtils.getHttpHeader200(content.getBytes().length) + content));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
